import http from "../utils/request";
// 报名相关接口

// 备份数据库
export function backupDefault(data) {
  return http({
    url: `/underwater-sound/databaseBackup/backupDefault`,
    method: "get",
    params: data,
  });
}

// 分页查询备份数据库历史记录
export function getBackupRecordList(data) {
  return http({
    url: `/underwater-sound/databaseBackup/getBackupRecordList`,
    method: "get",
    params: data,
  });
}

//   删除数据库备份的历史记录
export function removeBackupRecord(data) {
  return http({
    url: `/underwater-sound/databaseBackup/removeBackupRecord`,
    method: "get",
    params: data,
  });
}

// 通过系统参数编码获取系统参数值
export function findParamsValueByCode() {
  return http({
    url: `/underwater-sound/systemParameter/findParamsValueByCode`,
    method: "get",
  });
}

// 获取备份数据库的路径
export function getDBBackupPath() {
  return http({
    url: `/underwater-sound/systemParameter/getDBBackupPath`,
    method: "get",
  });
}

//   保存数据库备份路径
export function saveDBBackupPath(data) {
  return http({
    url: `/underwater-sound/systemParameter/saveDBBackupPath`,
    method: "post",
    data: data,
  });
}

// 批量下载导出元数据列信息
export function downloadColInfo() {
  return http({
    url: `/underwater-sound/metadataDictyCol/downloadColInfo`,
    method: "get",
  });
}

// 分页查找某个元数据表的列信息
export function findByTableId(query) {
  return http({
    url: `/underwater-sound/metadataDictyCol/findByTableId`,
    method: "get",
    params: query,
  });
}

// 分页查找某个元数据表的列信息 - 查询条件可能的值
export function findByTableIdQueryCondition(query) {
  return http({
    url: `/underwater-sound/metadataDictyCol/findByTableIdQueryCondition`,
    method: "get",
    params: query,
  });
}
export function deleteTable(id) {
  return http({
    url: `/underwater-sound/dataTableEntity/deleteTable/${id}`,
    method: "get",
  });
}
export function getColByTableId() {
  return http({
    url: `/underwater-sound/metadataDictyCol/getColByTableId`,
    method: "get",
  });
}

export function removeById(query) {
  return http({
    url: `/underwater-sound/metadataDictyTable/removeById`,
    method: "get",
    params: query,
  });
}
//   根据元数据列主键id查询更新历史
export function getColHisById(query) {
  return http({
    url: `/underwater-sound/metadataDictyCol/getColHis`,
    method: "get",
    params: query,
  });
}

//   新增元数据列信息
export function insertRecord(data) {
  return http({
    url: `/underwater-sound/metadataDictyCol/insertRecord`,
    method: "post",
    data: data,
  });
}

//   删除某个元数据表的列
export function removeByIdRecord(query) {
  return http({
    url: `/underwater-sound/metadataDictyCol/removeByIdRecord?metadataDictyColId=${query}`,
    method: "get",
  });
}

//   批量删除某个元数据表的列
export function removeByIdsRecord(data) {
  return http({
    url: `/underwater-sound/metadataDictyCol/removeByIdsRecord`,
    method: "post",
    data: data,
  });
}

//   根据元数据列主键id查询
export function selectByIdRecord(data) {
  return http({
    url: `/underwater-sound/metadataDictyCol/selectByIdRecord`,
    method: "post",
    data: data,
  });
}

//   根据元数据列id更新信息
export function updateByIdRecord(data) {
  return http({
    url: `/underwater-sound/metadataDictyCol/updateByIdRecord`,
    method: "post",
    data: data,
  });
}
// ---------------------------------
//   新增一个元数据表单
export function addMetadataDicty(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/addMetadataDicty`,
    method: "post",
    data: data,
  });
}

export function findBySearchContent(query) {
  return http({
    url: `/underwater-sound/metadataDictyCol/findBySearchContent`,
    method: "get",
    params: query,
  });
}

export function findListBySearchContent(query) {
  return http({
    url: `/underwater-sound/dataEntity/findListBySearchContent`,
    method: "get",
    params: query,
  });
}

// 获取元数据整个树信息
export function getAllTree() {
  return http({
    url: `/underwater-sound/metadataDictyTable/getAllTree`,
    method: "get",
  });
}
// 根据结构类型获取表单信息
export function getTableByStructureType(query) {
  return http({
    url: `/underwater-sound/metadataDictyTable/getTableByStructureType`,
    method: "get",
    params: query,
  });
}

// 根据表单id获取表单的列
export function selectByTableId(query) {
  return http({
    url: `/underwater-sound/dataColumnEntity/selectByTableId`,
    method: "get",
    params: query,
  });
}
// 下载数据信息 - 批量
export function downloadBatchDataInfo() {
  return http({
    url: `/underwater-sound/dataEntity/downloadBatchDataInfo`,
    method: "get",
  });
}
// 下载数据信息 - 单个
export function downloadDataInfo(data) {
  return http({
    url: `/underwater-sound/dataEntity/downloadDataInfo`,
    method: "post",
    responseType: "blob",
    data: data,
  });
}
// 获取某个表单的数据
export function findList(query) {
  return http({
    url: `/underwater-sound/dataEntity/findList`,
    method: "get",
    params: query,
  });
}
// 获取某个表单的数据-每列的可能值
export function findListQueryCondition(query) {
  return http({
    url: `/underwater-sound/dataEntity/findListQueryCondition`,
    method: "get",
    params: query,
  });
}
//   查询数据变更的历史   11111111111111111111111
export function getColHis(query) {
  return http({
    url: `/underwater-sound/dataEntity/getColHis`,
    method: "get",
    params: query,
  });
}
//   新增数据
export function insertDynamicData(data) {
  return http({
    url: `/underwater-sound/dataEntity/insertDynamicData`,
    method: "post",
    data: data,
  });
}
//   删除数据
export function removeDynamicDatas(data) {
  return http({
    url: `/underwater-sound/dataEntity/removeDynamicDatas`,
    method: "post",
    data: data,
  });
}
// 根据主键查表单数据
export function selectDynamicDataById() {
  return http({
    url: `/underwater-sound/dataEntity/selectDynamicDataById`,
    method: "get",
  });
}
//   根据主键id更新数据
export function updateDynamicData(data) {
  return http({
    url: `/underwater-sound/dataEntity/updateDynamicData`,
    method: "post",
    data: data,
  });
}
//  更新表
export function updateTableInfo(data) {
  return http({
    url: `/underwater-sound/dataTableEntity/updateTableInfo`,
    method: "post",
    data: data,
  });
}
// 获取 类型
export function getMetadataType() {
  return http({
    url: `/underwater-sound/metadataDictyTable/getMetadataType`,
    method: "get",
  });
}
// 通过元数据表单id查询对应的数据分类
export function getDataTypeByMeta() {
  return http({
    url: `/underwater-sound/dataTypeEntity/getDataTypeByMeta`,
    method: "get",
  });
}
// 获取菜单-第一级-业务库/水声信号数据
export function getDataTableByType(query) {
  return http({
    url: `/underwater-sound/dataTableEntity/getDataTableByType`,
    method: "get",
    params: query,
  });
}
/*
 * 创建表
 * @param {*} data
 *
 */
// {
//   "dataColumnVoList": [
//     {
//       "columnCode": "string",
//       "columnDisplay": "string",
//       "columnIndex": 0,
//       "columnName": "string",
//       "columnRequired": "string",
//       "columnType": "string",
//       "dataColumnId": "string",
//       "dataTableId": "string"
//     }
//   ],
//   "dataTableCode": "string",
//   "dataTableName": "string",
//   "dataTypeId": "string",
//   "dataTypeName": "string",
//   "databaseType": "string",
//   "metadataDictyTableId": "string"
// }
export function addDataStructure(data) {
  return http({
    url: `/underwater-sound/dataTableEntity/addDataStructure`,
    method: "post",
    data: data,
  });
}

// 分页获取文件信息
export function getFileListPage() {
  return http({
    url: `/underwater-sound/fileEntity/getFileList`,
    method: "get",
  });
}
//   清空当前用户所有摘取的临时记录
export function clearAll(data) {
  return http({
    url: `/underwater-sound/fileExtractEntity/clearAll`,
    method: "post",
    data: data,
  });
}
// 导出原始文件信息
export function downloadFileData() {
  return http({
    url: `/underwater-sound/fileExtractEntity/downloadFileData`,
    method: "get",
  });
}
// 导出原始文件数据
export function downloadOriginalData() {
  return http({
    url: `/underwater-sound/fileExtractEntity/downloadOriginalData`,
    method: "get",
  });
}
//   执行数据摘取
export function executeDataExtraction(data) {
  return http({
    url: `/underwater-sound/fileExtractEntity/executeDataExtraction`,
    method: "post",
    data: data,
  });
}
// 获取摘取临时表的菜单列表
export function getAllTreeTemp() {
  return http({
    url: `/underwater-sound/fileExtractEntity/getAllTree`,
    method: "get",
  });
}
// 分页查询表数据列表
export function getFileDataList() {
  return http({
    url: `/underwater-sound/fileExtractEntity/getFileDataList`,
    method: "get",
  });
}
// 分页查询文件列表
export function getFileList() {
  return http({
    url: `/underwater-sound/fileExtractEntity/getFileList`,
    method: "get",
  });
}
//   导入文件信息
export function importFiles(data) {
  return http({
    url: `/underwater-sound/fileExtractEntity/importFiles`,
    method: "post",
    data: data,
  });
}
// 需求新改接口
// 获取要素列表
export function getyaosuList(query) {
  return http({
    url: `/underwater-sound/metadataDictyTable/queryElementList`,
    method: "get",
    params: query,
  });
}
// 查询要素
export function searchyaosuList(id) {
  return http({
    url: `/underwater-sound/metadataDictyTable/queryElementInfo/${id}`,
    method: "get",
  });
}
// 删除要素
export function deleteyaosu(id) {
  return http({
    url: `/underwater-sound/metadataDictyTable/delElement/${id}`,
    method: "get",
  });
}
// 添加要素
export function addyaosu(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/addElement`,
    method: "post",
    data: data,
  });
}
// 修改要素
export function updateyaosu(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/updateElement`,
    method: "post",
    data: data,
  });
}

// 获取字典表格数据
export function getzidianList(query) {
  return http({
    url: `/underwater-sound/metadataDictyTable/queryWordsByDictName`,
    method: "get",
    params: query,
  });
}
// 获取字典菜单
export function zidianmenu() {
  return http({
    url: `/underwater-sound/metadataDictyTable/queryDictType`,
    method: "get",
  });
}
//新建字典表
export function createzidian(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/addDict`,
    method: "post",
    data: data,
  });
}
//删除字典表
export function deletezidian(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/deleteDictWords`,
    method: "post",
    data: data,
  });
}
// 修改词语条
export function updatezidian(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/updateDict`,
    method: "post",
    data: data,
  });
}
//查询模型列表
export function moxingmenu() {
  return http({
    url: `/underwater-sound/metadataDictyTable/queryMetadataModelList`,
    method: "get",
  });
}
//获取模型表格数据
export function modelData(query) {
  return http({
    url: `/underwater-sound/metadataDictyTable//queryMetadataModelElements`,
    method: "get",
    params: query,
  });
}
//创建模型
export function createModel(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/addMetadataModel`,
    method: "post",
    data: data,
  });
}

// 添加元素
export function addMetadataModelElement(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/addMetadataModelElement`,
    method: "post",
    data: data,
  });
}
// 删除元素
export function deleteModelElement(data) {
  return http({
    url: `/underwater-sound/metadataDictyTable/deleteModelElement`,
    method: "post",
    data: data,
  });
}
// 仪表盘
// 数据变化折线图
export function queryDataNumStatisticsByDate(query) {
  return http({
    url: `/underwater-sound/databaseCockpitController/queryDataNumStatisticsByDate`,
    method: "get",
    params: query,
  });
}
// 历史数据
export function queryWarehousingRecord() {
  return http({
    url: `/underwater-sound/databaseCockpitController/queryWarehousingRecord`,
    method: "get",
  });
}
// 表单引用排名
export function queryReferenceTablesRanking() {
  return http({
    url: `/underwater-sound/databaseCockpitController/queryReferenceTablesRanking`,
    method: "get",
  });
}
// 查询元数据标准统计数量
export function queryMetadataStandardStatistics(query) {
  return http({
    url: `/underwater-sound/databaseCockpitController/queryMetadataStandardStatistics`,
    method: "get",
    params: query,
  });
}
// 查询数据库数据数统计数量
export function queryDataBaseDataStatistics(query) {
  return http({
    url: `underwater-sound/databaseCockpitController/queryDataBaseDataStatistics`,
    method: "get",
    params: query,
  });
}

// 查询要素 不带分页
export function queryElements(query) {
  return http({
    url: `underwater-sound/metadataDictyTable/queryElements`,
    method: "get",
    params: query,
  });
}

// 查询属性选择：
export function queryFieldAttributeGroup(query) {
  return http({
    url: `underwater-sound/metadataDictyTable/queryFieldAttributeGroup`,
    method: "get",
    params: query,
  });
}
// 查询字段
export function queryFieldByFieldAttribute(query) {
  return http({
    url: `underwater-sound/metadataDictyTable/queryFieldByFieldAttribute`,
    method: "get",
    params: query,
  });
}

// 删除模型
export function deleteModel(query) {
  return http({
    url: `underwater-sound/metadataDictyTable/deleteModel`,
    method: "get",
    params: query,
  });
}

export function downloadDataInfo1(data) {
  return http({
    url: `/underwater-sound/dataEntity/downloadDataInfo1`,
    method: "post",
    responseType: "blob",
    data: data,
  });
}
export function downloadOneFile(data) {
  return http({
    url: `/underwater-sound/dataEntity/downloadOneFile`,
    method: "post",
    responseType: "blob",
    data: data,
  });
}
